package main.java.chessfootball.rules.checker;

import main.java.chessfootball.model.game.Area;

/**
 * User: Igor
 * Date: 27.07.2011
 * Time: 21:27:33
 */
public class OutGameAreaChecker extends AbstractPutChecker
{
	@Override
	public boolean valid()
	{
		boolean startSide = game.getMatch().getTime().getStartSide().equals(put.getSide());
		for (Area[] deniedArea : game.getMatch().getTime().getPeriod().getDeniedArea(startSide))
		{
			if (deniedArea[game.getField().getTeam(put.getSide()).getHalf().getId()].contains(put.getCell()))
			{
				return false;
			}
		}
		return true;
	}
}
